home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / u_man / cat1 / perlapio.Z / perlapio
Encoding:
Text File  |  1998-10-28  |  15.7 KB  |  397 lines

  1.  
  2.  
  3.  
  4.      PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       perlapio - perl's IO abstraction interface.
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           PerlIO *PerlIO_stdin(void);
  13.           PerlIO *PerlIO_stdout(void);
  14.           PerlIO *PerlIO_stderr(void);
  15.  
  16.           PerlIO *PerlIO_open(const    char *,const char *);
  17.           int     PerlIO_close(PerlIO *);
  18.  
  19.           int     PerlIO_stdoutf(const char    *,...)
  20.           int     PerlIO_puts(PerlIO *,const char *);
  21.           int     PerlIO_putc(PerlIO *,int);
  22.           int     PerlIO_write(PerlIO *,const void *,size_t);
  23.           int     PerlIO_printf(PerlIO *, const char *,...);
  24.           int     PerlIO_vprintf(PerlIO *, const char *, va_list);
  25.           int     PerlIO_flush(PerlIO *);
  26.  
  27.           int     PerlIO_eof(PerlIO    *);
  28.           int     PerlIO_error(PerlIO *);
  29.           void    PerlIO_clearerr(PerlIO *);
  30.  
  31.           int     PerlIO_getc(PerlIO *);
  32.           int     PerlIO_ungetc(PerlIO *,int);
  33.           int     PerlIO_read(PerlIO *,void    *,size_t);
  34.  
  35.           int     PerlIO_fileno(PerlIO *);
  36.           PerlIO *PerlIO_fdopen(int, const char *);
  37.           PerlIO *PerlIO_importFILE(FILE *,    int flags);
  38.           FILE   *PerlIO_exportFILE(PerlIO *, int flags);
  39.           FILE   *PerlIO_findFILE(PerlIO *);
  40.           void    PerlIO_releaseFILE(PerlIO    *,FILE *);
  41.  
  42.           void    PerlIO_setlinebuf(PerlIO *);
  43.  
  44.           long    PerlIO_tell(PerlIO *);
  45.           int     PerlIO_seek(PerlIO *,off_t,int);
  46.           int     PerlIO_getpos(PerlIO *,Fpos_t *)
  47.           int     PerlIO_setpos(PerlIO *,Fpos_t *)
  48.           void    PerlIO_rewind(PerlIO *);
  49.  
  50.           int     PerlIO_has_base(PerlIO *);
  51.           int     PerlIO_has_cntptr(PerlIO *);
  52.           int     PerlIO_fast_gets(PerlIO *);
  53.           int     PerlIO_canset_cnt(PerlIO *);
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))
  71.  
  72.  
  73.  
  74.           char   *PerlIO_get_ptr(PerlIO *);
  75.           int     PerlIO_get_cnt(PerlIO *);
  76.           void    PerlIO_set_cnt(PerlIO *,int);
  77.           void    PerlIO_set_ptrcnt(PerlIO *,char *,int);
  78.           char   *PerlIO_get_base(PerlIO *);
  79.           int     PerlIO_get_bufsiz(PerlIO *);
  80.  
  81.  
  82.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  83.       Perl's source    code should use    the above functions instead of
  84.       those    defined    in ANSI    C's _s_t_d_i_o._h.  The perl headers will
  85.       #define them to the I/O mechanism selected at    Configure
  86.       time.
  87.  
  88.       The functions    are modeled on those in    _s_t_d_i_o._h, but parameter
  89.       order    has been "tidied up a little".
  90.  
  91.       PPPPeeeerrrrllllIIIIOOOO ****
  92.           This takes the place of FILE *. Like FILE    * it should be
  93.           treated as opaque    (it is probably    safe to    assume it is a
  94.           pointer to something).
  95.  
  96.       PPPPeeeerrrrllllIIIIOOOO____ssssttttddddiiiinnnn(((()))), PPPPeeeerrrrllllIIIIOOOO____ssssttttddddoooouuuutttt(((()))), PPPPeeeerrrrllllIIIIOOOO____ssssttttddddeeeerrrrrrrr(((())))
  97.           Use these    rather than stdin, stdout, stderr. They    are
  98.           written to look like "function calls" rather than
  99.           variables    because    this makes it easier to    _m_a_k_e _t_h_e_m
  100.           function calls if    platform cannot    export data to loaded
  101.           modules, or if (say) different "threads" might have
  102.           different    values.
  103.  
  104.       PPPPeeeerrrrllllIIIIOOOO____ooooppppeeeennnn((((ppppaaaatttthhhh,,,, mmmmooooddddeeee)))), PPPPeeeerrrrllllIIIIOOOO____ffffddddooooppppeeeennnn((((ffffdddd,,,,mmmmooooddddeeee))))
  105.           These correspond to _f_o_p_e_n()/_f_d_o_p_e_n() arguments are the
  106.           same.
  107.  
  108.       PPPPeeeerrrrllllIIIIOOOO____pppprrrriiiinnnnttttffff((((ffff,,,,ffffmmmmtttt,,,,............)))), PPPPeeeerrrrllllIIIIOOOO____vvvvpppprrrriiiinnnnttttffff((((ffff,,,,ffffmmmmtttt,,,,aaaa))))
  109.           These are    _f_p_r_i_n_t_f()/_v_f_p_r_i_n_t_f() equivalents.
  110.  
  111.       PPPPeeeerrrrllllIIIIOOOO____ssssttttddddoooouuuuttttffff((((ffffmmmmtttt,,,,............))))
  112.           This is _p_r_i_n_t_f() equivalent. printf is #defined to this
  113.           function,    so it is (currently) legal to use
  114.           printf(fmt,...) in perl sources.
  115.  
  116.       PPPPeeeerrrrllllIIIIOOOO____rrrreeeeaaaadddd((((ffff,,,,bbbbuuuuffff,,,,ccccoooouuuunnnntttt)))), PPPPeeeerrrrllllIIIIOOOO____wwwwrrrriiiitttteeee((((ffff,,,,bbbbuuuuffff,,,,ccccoooouuuunnnntttt))))
  117.           These correspond to _f_r_e_a_d() and _f_w_r_i_t_e().    Note that
  118.           arguments    are different, there is    only one "count" and
  119.           order has    "file" first.
  120.  
  121.       PPPPeeeerrrrllllIIIIOOOO____cccclllloooosssseeee((((ffff))))
  122.  
  123.       PPPPeeeerrrrllllIIIIOOOO____ppppuuuuttttssss((((ffff,,,,ssss)))), PPPPeeeerrrrllllIIIIOOOO____ppppuuuuttttcccc((((ffff,,,,cccc))))
  124.           These correspond to _f_p_u_t_s() and _f_p_u_t_c().    Note that
  125.           arguments    have been revised to have "file" first.
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))
  137.  
  138.  
  139.  
  140.       PPPPeeeerrrrllllIIIIOOOO____uuuunnnnggggeeeettttcccc((((ffff,,,,cccc))))
  141.           This corresponds to _u_n_g_e_t_c().  Note that arguments have
  142.           been revised to have "file" first.
  143.  
  144.       PPPPeeeerrrrllllIIIIOOOO____ggggeeeettttcccc((((ffff))))
  145.           This corresponds to _g_e_t_c().
  146.  
  147.       PPPPeeeerrrrllllIIIIOOOO____eeeeooooffff((((ffff))))
  148.           This corresponds to _f_e_o_f().
  149.  
  150.       PPPPeeeerrrrllllIIIIOOOO____eeeerrrrrrrroooorrrr((((ffff))))
  151.           This corresponds to _f_e_r_r_o_r().
  152.  
  153.       PPPPeeeerrrrllllIIIIOOOO____ffffiiiilllleeeennnnoooo((((ffff))))
  154.           This corresponds to _f_i_l_e_n_o(), note that on some
  155.           platforms, the meaning of    "fileno" may not match Unix.
  156.  
  157.       PPPPeeeerrrrllllIIIIOOOO____cccclllleeeeaaaarrrreeeerrrrrrrr((((ffff))))
  158.           This corresponds to _c_l_e_a_r_e_r_r(), i.e., clears 'eof' and
  159.           'error' flags for    the "stream".
  160.  
  161.       PPPPeeeerrrrllllIIIIOOOO____fffflllluuuusssshhhh((((ffff))))
  162.           This corresponds to _f_f_l_u_s_h().
  163.  
  164.       PPPPeeeerrrrllllIIIIOOOO____tttteeeellllllll((((ffff))))
  165.           This corresponds to _f_t_e_l_l().
  166.  
  167.       PPPPeeeerrrrllllIIIIOOOO____sssseeeeeeeekkkk((((ffff,,,,oooo,,,,wwww))))
  168.           This corresponds to _f_s_e_e_k().
  169.  
  170.       PPPPeeeerrrrllllIIIIOOOO____ggggeeeettttppppoooossss((((ffff,,,,pppp)))), PPPPeeeerrrrllllIIIIOOOO____sssseeeettttppppoooossss((((ffff,,,,pppp))))
  171.           These correspond to _f_g_e_t_p_o_s() and    _f_s_e_t_p_o_s(). If platform
  172.           does not have the    stdio calls then they are implemented
  173.           in terms of _P_e_r_l_I_O__t_e_l_l()    and _P_e_r_l_I_O__s_e_e_k().
  174.  
  175.       PPPPeeeerrrrllllIIIIOOOO____rrrreeeewwwwiiiinnnndddd((((ffff))))
  176.           This corresponds to _r_e_w_i_n_d(). Note may be    redefined in
  177.           terms of _P_e_r_l_I_O__s_e_e_k() at    some point.
  178.  
  179.       PPPPeeeerrrrllllIIIIOOOO____ttttmmmmppppffffiiiilllleeee(((())))
  180.           This corresponds to _t_m_p_f_i_l_e(), i.e., returns an
  181.           anonymous    PerlIO which will automatically    be deleted
  182.           when closed.
  183.  
  184.       CCCCoooo----eeeexxxxiiiisssstttteeeennnncccceeee wwwwiiiitttthhhh ssssttttddddiiiioooo
  185.  
  186.       There    is outline support for co-existence of PerlIO with
  187.       stdio.  Obviously if PerlIO is implemented in    terms of stdio
  188.       there    is no problem. However if perlio is implemented    on top
  189.       of (say) sfio    then mechanisms    must exist to create a FILE *
  190.       which    can be passed to library code which is going to    use
  191.       stdio    calls.
  192.  
  193.  
  194.  
  195.      Page 3                        (printed 10/23/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))
  203.  
  204.  
  205.  
  206.       PPPPeeeerrrrllllIIIIOOOO____iiiimmmmppppoooorrrrttttFFFFIIIILLLLEEEE((((ffff,,,,ffffllllaaaaggggssss))))
  207.           Used to get a PerlIO * from a FILE *.  May need
  208.           additional arguments, interface under review.
  209.  
  210.       PPPPeeeerrrrllllIIIIOOOO____eeeexxxxppppoooorrrrttttFFFFIIIILLLLEEEE((((ffff,,,,ffffllllaaaaggggssss))))
  211.           Given an PerlIO *    return a 'native' FILE * suitable for
  212.           passing to code expecting    to be compiled and linked with
  213.           ANSI C _s_t_d_i_o._h.
  214.  
  215.           The fact that such a FILE    * has been 'exported' is
  216.           recorded,    and may    affect future PerlIO operations    on the
  217.           original PerlIO *.
  218.  
  219.       PPPPeeeerrrrllllIIIIOOOO____ffffiiiinnnnddddFFFFIIIILLLLEEEE((((ffff))))
  220.           Returns previously 'exported' FILE * (if any).  Place
  221.           holder until interface is    fully defined.
  222.  
  223.       PPPPeeeerrrrllllIIIIOOOO____rrrreeeelllleeeeaaaasssseeeeFFFFIIIILLLLEEEE((((pppp,,,,ffff))))
  224.           Calling PerlIO_releaseFILE informs PerlIO    that all use
  225.           of FILE *    is complete. It    is removed from    list of
  226.           'exported' FILE *s, and associated PerlIO    * should
  227.           revert to    original behaviour.
  228.  
  229.       PPPPeeeerrrrllllIIIIOOOO____sssseeeettttlllliiiinnnneeeebbbbuuuuffff((((ffff))))
  230.           This corresponds to _s_e_t_l_i_n_e_b_u_f().    Use is deprecated
  231.           pending further discussion. (Perl    core uses it _o_n_l_y when
  232.           "dumping"; it has    nothing    to do with $| auto-flush.)
  233.  
  234.       In addition to user API above    there is an "implementation"
  235.       interface which allows perl to get at    internals of PerlIO.
  236.       The following    calls correspond to the    various    FILE_xxx
  237.       macros determined by Configure. This section is really of
  238.       interest to only those concerned with    detailed perl-core
  239.       behaviour or implementing a PerlIO mapping.
  240.  
  241.       PPPPeeeerrrrllllIIIIOOOO____hhhhaaaassss____ccccnnnnttttppppttttrrrr((((ffff))))
  242.           Implementation can return    pointer    to current position in
  243.           the "buffer" and a count of bytes    available in the
  244.           buffer.
  245.  
  246.       PPPPeeeerrrrllllIIIIOOOO____ggggeeeetttt____ppppttttrrrr((((ffff))))
  247.           Return pointer to    next readable byte in buffer.
  248.  
  249.       PPPPeeeerrrrllllIIIIOOOO____ggggeeeetttt____ccccnnnntttt((((ffff))))
  250.           Return count of readable bytes in    the buffer.
  251.  
  252.       PPPPeeeerrrrllllIIIIOOOO____ccccaaaannnnsssseeeetttt____ccccnnnntttt((((ffff))))
  253.           Implementation can adjust    its idea of number of bytes in
  254.           the buffer.
  255.  
  256.       PPPPeeeerrrrllllIIIIOOOO____ffffaaaasssstttt____ggggeeeettttssss((((ffff))))
  257.           Implementation has all the interfaces required to    allow
  258.  
  259.  
  260.  
  261.      Page 4                        (printed 10/23/98)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))
  269.  
  270.  
  271.  
  272.           perl's fast code to handle <FILE>    mechanism.
  273.  
  274.         PerlIO_fast_gets(f) = PerlIO_has_cntptr(f) && \
  275.                       PerlIO_canset_cnt(f) && \
  276.                       `Can set pointer into buffer'
  277.  
  278.  
  279.       PPPPeeeerrrrllllIIIIOOOO____sssseeeetttt____ppppttttrrrrccccnnnntttt((((ffff,,,,pppp,,,,cccc))))
  280.           Set pointer into buffer, and a count of bytes still in
  281.           the buffer. Should be used only to set pointer to    within
  282.           range implied by previous    calls to PerlIO_get_ptr    and
  283.           PerlIO_get_cnt.
  284.  
  285.       PPPPeeeerrrrllllIIIIOOOO____sssseeeetttt____ccccnnnntttt((((ffff,,,,cccc))))
  286.           Obscure -    set count of bytes in the buffer. Deprecated.
  287.           Currently    used in    only doio.c to force count < -1    to -1.
  288.           Perhaps should be    PerlIO_set_empty or similar.  This
  289.           call may actually    do nothing if "count" is deduced from
  290.           pointer and a "limit".
  291.  
  292.       PPPPeeeerrrrllllIIIIOOOO____hhhhaaaassss____bbbbaaaasssseeee((((ffff))))
  293.           Implementation has a buffer, and can return pointer to
  294.           whole buffer and its size. Used by perl for ----TTTT / ----BBBB
  295.           tests.  Other uses would be very obscure...
  296.  
  297.       PPPPeeeerrrrllllIIIIOOOO____ggggeeeetttt____bbbbaaaasssseeee((((ffff))))
  298.           Return _s_t_a_r_t of buffer.
  299.  
  300.       PPPPeeeerrrrllllIIIIOOOO____ggggeeeetttt____bbbbuuuuffffssssiiiizzzz((((ffff))))
  301.           Return _t_o_t_a_l _s_i_z_e    of buffer.
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.      Page 5                        (printed 10/23/98)
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       PPPPEEEERRRRLLLLAAAAPPPPIIIIOOOO((((1111))))
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.      Page 6                        (printed 10/23/98)
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.